export async function safeCall<T>(promise: Promise<T>, errorMsg: string): Promise<T | undefined> {
  try {
    return await promise;
  } catch (e: any) {
    alert(errorMsg + (e?.message ? `: ${e.message}` : ''));
    return undefined;
  }
} 